package com.andyage.util;

import java.util.HashMap;
import java.util.Map;

/**
 * 类型转换工具类
 * @author ziang
 *
 */
public class TypeTransfor {
	/**
	 * 男女
	 * @param gender
	 * @return
	 */
	public static String userSexTransfor(String userSex) {
		Map<String, String> sex=new HashMap<String, String>();
		sex.put("1", "男");
		sex.put("2", "女");
		sex.put("男", "1");
		sex.put("女", "2");
		return sex.get(userSex);

	}
	/**
	 * 男士女士
	 * @param gender
	 * @return
	 */
	public static String userGenderTransfor(String gender) {
		Map<String, String> sex=new HashMap<String, String>();
		sex.put("1", "男士");
		sex.put("2", "女士");
		sex.put("女士", "2");
		sex.put("男士", "1");
		return sex.get(gender);

	}
	public static String yesOrNoTransfor(String param) {
		Map<String, String> params=new HashMap<String, String>();
		params.put("0", "离职");
		params.put("1", "在职");
		params.put("离职", "0");
		params.put("在职", "1");
		return params.get(param);
	}
	/**
	 * 是否需要收货地址
	 * @param param
	 * @return
	 */
	public static String itemUseReceiveraddress(String param) {
		Map<String, String> params=new HashMap<String, String>();
		params.put("false", "否");
		params.put("true", "是");
		params.put("否", "false");
		params.put("是", "true");
		return params.get(param);
	}
	/**
	 * 审核
	 * @param param
	 * @return
	 */
	public static String paStatusMap(String param) {
		Map<String, String> params=new HashMap<String, String>();
		params.put("1", "待审核");
		params.put("2", "审核通过");
		params.put("3", "审核未通过");
		params.put("待审核", "1");
		params.put("审核通过", "3");
		params.put("审核未通过", "4");
		return params.get(param);

	}
	public static String payStatus(int param) {
		Map<Integer, String> params=new HashMap<Integer, String>();
		params.put(0, "未支付");
		params.put(1, "已支付");
		return params.get(param);
		// TODO Auto-generated method stub

	}
	/**
	 * 判断String内容是否为int类型
	 * @param param
	 * @return
	 */
	public static boolean isNumber(String param) {
		try {
			Integer.parseInt(param);
			return true;
		} catch (NumberFormatException e) {
			e.getMessage();
		}
		return false;
	}
}
